package com.example.demo.model;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 张杰
 * Date: 2022-08-07
 * Time: 11:06
 */
@RestController
public class CalcController {

    @RequestMapping("/calc")
    public String calc(Integer num1,Integer num2) {
        if(num1 == null || num2 == null) {
            return "<h1>参数返回错误！</h1><a href='javascript:history.go(-1)'>返回</a>";
        }
        return "<h1>结果：" + (num1 + num2) + "</h1><a href='javascript:history.go(-1)'>返回</a>";
    }
}
